{template 'common/header'}
<div class="main">
	<form class="form-horizontal form" id="form2" action="" method="post" enctype="multipart/form-data">
		<div class="panel panel-default">
			<div class="panel-heading">
				基本参数
			</div>
			<div class="panel-body">
				<!--<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">网页签到邀请按钮开关</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<div class="input-group">
							<label class="radio-inline">
								<input type="radio" name="base[web_switch]" value="1" {if $this->module['config']['base']['web_switch']}checked{/if}> 是
							</label>
							<label class="radio-inline">
								<input type="radio" name="base[web_switch]" value="0" {if !$this->module['config']['base']['web_switch']}checked{/if}> 否
							</label>
						</div>
						<span class="help-block">控制网页签到页邀请好友按钮是否显示</span>
					</div>
				</div>-->
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">头像昵称来源</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<div class="input-group">
							<label class="radio-inline">
								<input type="radio" name="base[info_from]" value="members" {if $this->module['config']['base']['info_from']=='members'}checked{/if}> 会员表
							</label>
							<label class="radio-inline">
								<input type="radio" name="base[info_from]" value="fans" {if $this->module['config']['base']['info_from']=='fans'}checked{/if}> 粉丝表
							</label>
							<label class="radio-inline">
								<input type="radio" name="base[info_from]" value="smart" {if !isset($this->module['config']['base']['info_from'])||$this->module['config']['base']['info_from']=='smart'}checked{/if}> 智能
							</label>
						</div>
						<span class="help-block">会员表：从会员表获取头像、昵称等数据</span>
						<span class="help-block">会员表：从会员表获取头像、昵称等数据</span>
						<span class="help-block">粉丝表：从粉丝表获取头像、昵称等数据</span>
						<span class="help-block">智能：优先使用会员表获取，如果获取不到时，自动从粉丝表加载</span>
						<span class="help-block" style="color: red">注意：因为部分公众号会员和粉丝数据不一致，导致不一致的原因有很多，如未开启会员自动注册，所以提供此解决方法</span>
					</div>
				</div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 control-label">签到排行榜条数</label>
                    <div class="col-sm-6 col-md-8 col-xs-12">
                        <input type="text" class="form-control" name="base[pagesize]" value="{php echo $this->module['config']['base']['pagesize']}" placeholder="10"/>
                        <span class="help-block">默认显示前10条数据，可自定义显示条数</span>
                    </div>
                </div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">老用户限制开关</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<div class="input-group">
							<label class="radio-inline">
								<input type="radio" name="base[old_user_limit]" value="1" {if $this->module['config']['base']['old_user_limit']}checked{/if}> 是
							</label>
							<label class="radio-inline">
								<input type="radio" name="base[old_user_limit]" value="0" {if !$this->module['config']['base']['old_user_limit']}checked{/if}> 否
							</label>
						</div>
						<span class="help-block">开启后，用户邀请的用户若过去已关注(或关注过)本平台，则不算新邀请用户，不给邀请人和被邀请人加积分。</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">暗号前缀</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<input type="text" class="form-control" name="base[anhao_prefix]" value="{php echo $this->module['config']['base']['anhao_prefix']}" />
						<span class="help-block">填写邀请人暗号的前缀，只可为纯字母，可设置尽量简单方便被邀请人的输入，例如 ABC。区分大小写。</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">邀请奖励积分类型</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<select name="base[credit_type]" class="form-control">
							{loop $credits $key $item}
							{if $item['enabled'] == 1}
							<option value="{$key}" {if $this->module['config']['base']['credit_type']==$key}selected{/if}>{$item['title']}</option>
							{/if}
							{/loop}
						</select>
						<span class="help-block">邀请和被邀请成功赠送积分类型</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">邀请好友关注积分</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<input type="text" class="form-control" name="base[invite_one]" value="{php echo $this->module['config']['base']['invite_one']}" />
						<span class="help-block">用户每成功邀请一个朋友关注并输入暗号所加积分</span>
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">被邀请关注积分</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<input type="text" class="form-control" name="base[invited]" value="{php echo $this->module['config']['base']['invited']}" />
						<span class="help-block">被邀请用户首次关注并输入暗号所加积分</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">每日邀请所得积分上限</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<input type="text" class="form-control" name="base[credit_limit]" value="{php echo $this->module['config']['base']['credit_limit']>0?$this->module['config']['base']['credit_limit']:500}" />
						<span class="help-block">默认500，不可为空</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">邀请页顶部图片</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						{php echo tpl_form_field_image('base[invite_img]', $this->module['config']['base']['invite_img'])}
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">邀请页规则内容</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						{php echo tpl_ueditor('base[invite_rule]', $this->module['config']['base']['invite_rule'])}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">被邀请页展示内容</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						{php echo tpl_ueditor('base[invited_show]', $this->module['config']['base']['invited_show'])}
					</div>
				</div>
			</div>
		</div>
		<div class="panel panel-default">
			<div class="panel-heading">
				邀请页分享设置
			</div>
			<div class="panel-body">
				<div class="alert alert-danger">已认证公众号可以设置以下分享参数，否则没有权限调用JSSDK分享接口</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">分享标题</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<input type="text" class="form-control" name="base[share_title]" value="{php echo $this->module['config']['base']['share_title']}" />
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">分享图片</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						{php echo tpl_form_field_image('base[share_imgurl]', $this->module['config']['base']['share_imgurl'])}
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">分享内容</label>
					<div class="col-sm-6 col-md-8 col-xs-12">
						<textarea name="base[share_desc]" class="form-control">{php echo $this->module['config']['base']['share_desc']}</textarea>
						<span class="help-block"></span>
					</div>
				</div>
			</div>
		</div>
        <div class="panel panel-default">
            <div class="panel-heading">
                签到提示消息
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">没有找到暗号前缀规则</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[anhao_rule]" value="{php echo $this->module['config']['message']['anhao_rule']}" placeholder="没有找到暗号前缀规则"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">签到功能未配置</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[not_setting]" value="{php echo $this->module['config']['message']['not_setting']}" placeholder="签到功能未配置"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">签到功能未开启</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[not_open]" value="{php echo $this->module['config']['message']['not_open']}" placeholder="签到功能未开启"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">今日签到还没开始哦</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[not_start]" value="{php echo $this->module['config']['message']['not_start']}" placeholder="今日签到还没开始哦"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">今日签到已结束，请明天再来</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[over]" value="{php echo $this->module['config']['message']['over']}" placeholder="今日签到已结束，请明天再来"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">签到成功提示语未设置</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[success_msg_tip]" value="{php echo $this->module['config']['message']['success_msg_tip']}" placeholder="签到成功提示语未设置"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">签到失败提示语未设置</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[fail_msg_tip]" value="{php echo $this->module['config']['message']['fail_msg_tip']}" placeholder="签到失败提示语未设置"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">请先关注公众号</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[subscribe]" value="{php echo $this->module['config']['message']['subscribe']}" placeholder="请先关注公众号"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">未设置签到积分</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[not_credit]" value="{php echo $this->module['config']['message']['not_credit']}" placeholder="未设置签到积分"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">您已经签到了</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[signed]" value="{php echo $this->module['config']['message']['signed']}" placeholder="您已经签到了"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-3 control-label">关注公众号一键签到</label>
                    <div class="col-sm-9 col-md-9 col-xs-12">
                        <input type="text" class="form-control" name="message[subscribe_one]" value="{php echo $this->module['config']['message']['subscribe_one']}" placeholder="关注公众号一键签到"/>
                    </div>
                </div>
            </div>
        </div>
		<div class="form-group col-sm-12">
			<input name="token" type="hidden" value="{$_W['token']}" />
			<input type="submit" class="btn btn-primary" name="submit" value="提交" />
		</div>
		<script type="text/javascript">
			require(['jquery', 'util'], function($, u){
				$('#form2').submit(function(){
					var anhao_prefix = $('input[name="base[anhao_prefix]"]');
					if (anhao_prefix.val() == '') {
						util.message('请输入暗号前缀');
						return false;
					}
					var invite_one = $('input[name="base[invite_one]"]');
					if (invite_one.val() == '') {
						util.message('请输入邀请好友关注积分');
						return false;
					}
					var invited = $('input[name="base[invited]"]');
					if (invited.val() == '') {
						util.message('请输入被邀请关注积分');
						return false;
					}
				});
			});
		</script>
	</form>
</div>
{template 'common/footer'}